<div class="container">
    <div class="row">
        <div class="col-md-8">
            <ol class="breadcrumb">
                <li><a href="<?= Yii::$app->homeUrl; ?>">首页</a></li>
                <li><a href="<?= \yii\helpers\Url::to(['post/index']) ?>">文章列表</a></li>
                <li class="active"><?= $model->title ?></li>
            </ol>

            <div class="post">
                <div class="title">
                    <h2><a href="<?= $model->url; ?>"><?= \yii\helpers\Html::encode($model->title); ?></a></h2>
                    <div class="author">
                        <span class="glyphicon glyphicon-time" aria-hidden="true"></span><em><?= date('Y-m-d H:i:s', $model->create_time)?></em>
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <span class="glyphicon glyphicon-user" aria-hidden="true"></span><em><?= \yii\helpers\Html::encode($model->author->nickname)?></em>
                    </div>
                </div>
            </div>

            <br>

            <div class="content">
                <?= \yii\helpers\HtmlPurifier::process($model->content) ?>
            </div>

            <div class="nav">
                <span class="glyphicon glyphicon-tag" aria-hidden="true"></span>
                <?= implode(', ', $model->tagLinks); ?>
                <br>
                <?= \yii\helpers\Html::a("评论（{$model->commentCount}）", $model->url . '#comments')?> | 最后修改于 <?= date('Y-m-d H:i:s', $model->update_time)?>
            </div>
            
            <div class="comment">
                <?php if ($added) {?>
                <div class="alert alert-warning">
                    <a href="#" class="close" data-dismiss="alert">
                        &times;
                    </a>
                    <strong>警告！</strong>您的网络连接有问题。
                    <h4>谢谢您的回复，我们会尽快审核发布出来</h4>
                    <span class="glyphicon glyphicon-time" aria-hidden="true"></span><em><?= date('Y-m-d H:i:s', $model->create_time)?></em>
                    <span class="glyphicon glyphicon-user" aria-hidden="true"></span><em><?= \yii\helpers\Html::encode($model->author->nickname)?></em>
                </div>
                <?php } ?>

                <?php if ($model->commentCount >= 1) : ?>
                <h5><?= $model->commentCount . '条评论'; ?></h5>
                <?= $this->render('_comment',[
                        'post' => $model,
                        'comments' => $model->comments,
                    ]);?>
                <?php endif;?>

                <h5>发表评论</h5>
                <?php
                $postComment = new \common\models\Comment();
                echo $this->render('_guestform',[
                        'id' => $model->id,
                        'postModel' => $postComment,
                ]);
                ?>
            </div>
        </div>
        <div class="col-md-4">
            <div class="searchbox">
                <ul class="list-group">
                    <li class="list-group-item">
                        <span class="glyphicon glyphicon-search" aria-hidden="true"></span> 查找文章
                    </li>
                    <li class="list-group-item">
                        <form action="<?= \yii\helpers\Url::to(['post/index'])?>" class="form-inline" id="w0" method="get">
                            <div class="form-group">
                                <input type="text" class="form-control" id="w0input" name="PostSearch[title]" placeholder="按标题">

                            </div>
                            <div class="form-group">
                                <button type="submit" class="btn btn-default">搜索</button>
                            </div>
                        </form>
                    </li>
                </ul>
            </div>

            <div class="tagcloudbox">
                <ul class="list-group">
                    <li class="list-group-item">
                        <span class="glyphicon glyphicon-search" aria-hidden="true"></span> 标签云
                    </li>
                    <li class="list-group-item">
                        <?= \frontend\components\TagsCloudWidget::widget(['tags' => $tags])?>
                    </li>
                </ul>
            </div>

            <div class="commentbox">
                <ul class="list-group">
                    <li class="list-group-item">
                        <span class="glyphicon glyphicon-search" aria-hidden="true"></span> 最新评论
                    </li>
                    <li class="list-group-item">
                        <?= \frontend\components\RctReplyWidget::widget(['recentComments' => $recentComments])?>
                    </li>
                </ul>
            </div>
        </div>
    </div>
</div>
